<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>临时资源信息管理</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		
		<link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css">		
		<script type="text/javascript" charset="utf-8" src="extjs/ext-all.js"></script>
		<script type="text/javascript" charset="utf-8" src="extjs/locale/ext-lang-zh_CN.js"></script>
		
		<link rel="stylesheet" href="res/css/list.css" type="text/css" />
		<script type="text/javascript" src="res/js/util.js"></script>
		<script type="text/javascript" src="resource/js/tmp_res.js"></script>
		<script type="text/javascript">
			function download(id) {
				if(confirm("确定要下载该资源吗？")) {
					window.location.href="<%=basePath%>res/downloadTmpRes.action?id=" + id;
				}
			}
		</script>
	</head>

	<body>
		<form name="form" method="post" action="res/loadTmpRes.action?nodeId=${nodeId }&nodeText=${nodeText }" onsubmit="return check();">
			<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1"
				bordercolor="#799AE1" class="tableBorder">
				<tbody>
					<tr>
						<th align="center" colspan="4" style="height:23px;text-align: center;">
							<s:property value="nodeText" />
						</th>
					</tr>
					<tr bgcolor="#DEE5FA">
						<td colspan="4" align="left" class="txlrow">
							<img alt="新增" src="res/images/add.gif">&nbsp;&nbsp;<a href="javascript:showAddForm();">上传临时资源</a>
							<!-- 
							<a style="color:red;" href="javascript:showBatchAddForm();">批量导入</a>
							 -->
						</td>
					</tr>
					<tr align="center" bgcolor="#799AE1">
						<td width="3%" align="center" class=txlHeaderBackgroundAlternate>
							选定
						</td>
						<td width="7%" align="center" class=txlHeaderBackgroundAlternate>
							名称
						</td>
						<td width="7%" align="center" class=txlHeaderBackgroundAlternate>
							上传时间
						</td>
						<td width="16%" align="center" class=txlHeaderBackgroundAlternate>
							操作
						</td>
					</tr>
					<s:if test="items==null || items.size() == 0">
						<tr bgcolor="#DEE5FA">
							<td colspan="9" align="center" class="txlrow">暂无数据！</td>
						</tr>
					</s:if>
					<s:else>
						<s:iterator value="items">
							<tr bgcolor="#DEE5FA">
								<td align=center class=txlrow>
									<input type="checkbox" name="chk" value="<s:property value='id' />">
								</td>
								<td align="center" class="txlrow">
									<s:property value="name" />
								</td>
								<td align=center class=txlrow>
									<s:property value="uploadTime" />
								</td>
								<td align=center class=txlrow>
									<!-- 
									<img alt="修改" src="res/images/edit.gif">&nbsp;<a href="javascript:showUpdateForm(<s:property value='info.id' />);">修改</a>
									 -->
									<img alt="删除" src="res/images/delete.gif">&nbsp;<a href="javascript:deleteCmd(<s:property value='id' />);">删除</a>&nbsp;&nbsp;&nbsp;&nbsp;
									<img alt="下载" src="res/images/download_icon.gif" onclick="javascript:download(<s:property value='id' />);">
								</td>
							</tr>
						</s:iterator>
					</s:else>
					<tr bgcolor="#DEE5FA">
						<td colspan="2" align="center" bgcolor="#DEE5FA" class="txlrow">
							<s:if test="pageBean == null">
							</s:if>
							<s:else>
								<input type="hidden" id="pageBean.currPage" name="pageBean.currPage" value="${pageBean.currPage}" />
								<input type="hidden" id="pageBean.totalPage" name="pageBean.totalPage" value="${pageBean.totalPage}" />
								<a href="javascript:skipPage(${pageBean.currPage - 1 });">上一页</a>&nbsp;&nbsp;
								第
								<select id="currPage" name="currPage" onchange="javascript:skipPage(this.value);">
									<c:if test="${pageBean.totalPage eq 0}">
										<option value="1">1</option>
									</c:if>
									<c:forEach begin="1" end="${pageBean.totalPage }" step="1"
											var="pageNum">
											<option value="${pageNum}"  <c:if test="${pageBean.currPage == pageNum }"> selected="selected"</c:if>>${pageNum}</option>
									</c:forEach>
								</select>
								页
								<a href="javascript:skipPage(${pageBean.currPage + 1 });">下一页</a>&nbsp;&nbsp;
								共
								<c:choose>
									<c:when test="${pageBean.totalPage eq 0}">
										1
									</c:when>
									<c:otherwise>
										${pageBean.totalPage}
									</c:otherwise>
								</c:choose>
								页
							</s:else>
						</td>
						<td colspan="2" align="center" bgcolor="#DEE5FA" class="txlrow">
							<span class="tablebody2">
								<input type="button" value="全选" name="Submit2" onClick="selectAll()" />
								<input type="button" value="取消全选" name="Submit2" onClick="unSelectAll();" />
								<input type="button" value="批量删除" name="Submit2" onClick="batchDel();" />
							</span>
							<input type="submit" name="ok" value="确定" class="but">
						</td>
					</tr>
				</tbody>
			</table>
		</FORM>
	</body>
</html>
